<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        //js代码
        let object = {
            "id":"100",
            "username":"tom",
            "password":"123456",
            "permissions":[
                {
                    "id":1,
                    "name":"创建商品",
                    "value":"/product/create"
                },
                {
                    "id":2,
                    "name":"删除商品",
                    "value":"/product/delete"
                },
                {
                    "id":3,
                    "name":"查询商品",
                    "value":"/product/show"
                }
            ]
        };
        console.log("id:"+object.id);
        console.log("username:"+object.username);
        console.log("password:"+object.password);
        console.log("----以下是权限信息----")
        for(let i=0;i<object.permissions.length;i++){
            console.log(object.permissions[i]);
            let permission = object.permissions[i];
            console.log("per_id:"+permission.id);
            console.log("per_name:"+permission.name);
            console.log("per_value:"+permission.value);
        }
    </script>
    <script src="js/jquery-1.9.1.min.js"></script>
    <script src="js/jquery.cookie.js"></script>
    <script>
        $(function(){
            $("#req").click(function(){
                let token = $.cookie("token");
                alert(token);
                $.ajax({
                    type:"post",
                    url:"/admin/hello",
                    dataType:"json",
                    headers:{"Authentication":token},
                    success:function(json){
                        if(json.state == 2000){
                            alert("okkkkkk");
                        }else{
                            alert(json.message)
                        }
                    }
                });
            });
        });
    </script>
</head>
<body>
    <button id="req">请求携带jwt</button>
</body>
</html>